(function() {
	const response = {
		type: 'page',
		name: "assetBorrow",
		title: '已申请借用的资产',
		"toolbar": [
			{
				type: "button",
				label: "点击此处申请资产借用",
				// size: "lg",
				level: "primary",//为按钮添加蓝色
				syncLocation: false,
				actionType: "dialog",
				dialog: {

					title: "资产借用申请",
					body: [
						{
							type: "form",
							api: "post:/applicant/insertAssetSecondment",
							//表单提交后刷新页面
							"onEvent": {
								"submitSucc": {
									"weight": 0,
									"actions": [
										{
											"actionType": "refresh"
										}
									]
								}
							},
							body: [
								{
									"label": "资产类型",
									"type": "radios",
									"name": "assetClasses",
									"inline": true,
									value: "HARDWARE_ASSET",
									"options": [
										{
											"label": "硬件资产",
											value: "HARDWARE_ASSET"
										},
										{
											"label": "软件资产",
											"value": "SOFTWARE_ASSET"
										},
										{
											"label": "虚拟资产",
											"value": "VIRTUAL_ASSET"
										}
									],
									"onEvent": {
										"change": {
											"weight": 0,
											"actions": [
												{
													"componentId": "assetNameComponent",
													"args": {
														"value": ""
													},
													"actionType": "setValue"
												}
											]
										}
									}
								},
								{
									"label": "资产名",
									"type": "select",
									"size": "m-lg",
									"name": "assetName",
									"id": "assetNameComponent",
									//占位文字
									"placeholder": "请选择你需要借用的资产名称",
									//悬停提示
									"labelRemark": {
										"icon": "fa fa-question-circle",
										"trigger": [
											"hover"
										],
										"className": "Remark--warning",
										"placement": "top",
										"title": "通过资产类型动态识别可借资产"
									},
									//动态获取下拉框选项
									"source": {
										method: "get",
										url: "/applicant/getAllowBorrowAssetsByClasses/${assetClasses}"
									},

									"description": ""
								},
								{
									type: "input-text",
									name: "secondmentReason",
									label: "申请理由"
								},
								{
									type: "hidden",
									name: "status",
									value: "BORROW"
								}
							]
						}

					]
				},
			}
			,
			{
				"type": "button",
				"label": "前往登录",
				"onEvent": {
					"click": {
						"actions": [
							{
								"args": {
									"url": "/index.html"
								},
								"actionType": "url"
							}
						]
					}
				},
				"id": "u:0ab60fdf7028"
			}
		],
		body:[
			{
				"type": "page",
				"body": {
					"id": "getAssetSecondments",
					"name": "getAssetSecondments",
					"type": "crud",
					"api": "post:/applicant/getAssetSecondments",
					loadDataOnce: true,
					"autoFillHeight": true,
					//从响应中过滤出”借用“的资产
					"source": "${items | filter:status:match:'借用'}",
					"headerToolbar": [
						{
							//导出excel，只支持导出当前页面数据
							"type": "export-excel",
							filename: "借用申请",
							//自定义导出列
							columns:[
								"id",
								"assetName",
								"assetClasses",
								"applicantId",
								"secondmentReason",
								"classes",
								"result",
								"createTime",
								"isComplete"
							]
						},{
							type: "reload"
						}
					],
					//${xxx|filter:a,b:match:'123'}
					"columns": [
						{
							"name": "id",
							"label": "申请编号"
						},
						{
							"name": "assetName",
							"label": "资产名"
						},
						{
							"name": "assetClasses",
							"label": "资产类别"
						},
						{
							"name": "applicantId",
							"label": "申请人ID"
						},
						{
							"name": "secondmentReason",
							"label": "借用理由"
						},
						{
							"name": "result",
							"label": "申请进度"
						},
						{
							"name": "createTime",
							"label": "申请时间",
							"type": "date",
							"fromNow": true,//输出现在距离具体日期还有多久
						},
						{
							"name": "isComplete",
							"label": "申请状态"
						},
						{
							"name": "status",
							"label": "status",
							hidden: true
						}

					]
				}
			}
		]

	}

	window.jsonpCallback && window.jsonpCallback(response);
})();
